package qianting.news.wemedia.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import qianting.news.apis.models.user.pojos.WmSensitive;
import qianting.news.apis.models.wemedia.dtos.SensitiveDto;
import qianting.news.common.entity.State;
import qianting.news.wemedia.service.WmSensitiveService;

@Api(tags = "敏感词管理")
@RestController
@RequestMapping("/sensitive")
public class WmSensitiveController {

    @Autowired
    private WmSensitiveService wmSensitiveService;

    @ApiOperation(value = "模糊查询敏感词列表")
    @PostMapping("/list")
    public State list(@RequestBody SensitiveDto dto){
        return wmSensitiveService.list(dto);
    }

    @ApiOperation(value = "新增敏感词")
    @PostMapping("/save")
    public State insert(@RequestBody WmSensitive wmSensitive){
        return wmSensitiveService.insert(wmSensitive);
    }

    @ApiOperation(value = "修改敏感词")
    @PostMapping("/update")
    public State update(@RequestBody WmSensitive wmSensitive){
        return wmSensitiveService.update(wmSensitive);
    }

    @ApiOperation(value = "删除敏感词")
    @DeleteMapping("/del/{id}")
    public State delete(@PathVariable("id") Integer id){
        return wmSensitiveService.delete(id);
    }
}
